﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StudentCourseUT
{
    public class Student: IComparable<Student>
    {
        private string name;
        private int number;

        public Student(string name, int number)
        {
            this.Name = name;
            this.Number = number;
        }

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                if (value != string.Empty)
                {
                    name = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Name must not be with zero lenght");
                }
            }
        }

        public int Number
        {
            get
            {
                return number;
            }
            set
            {
                if (value > 10000 && value < 99999)
                {                    
                    number = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException(String.Format("Faculty number {0} is not a valid argument", value));
                }
            }
        }

        public int CompareTo(Student other)
        {
            return (this.number - other.number);
        }
    }
}
